﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using PhotoHsn.WebApp.Core;
using PhotoHsn.BLL.Generic;
using System.Data.SqlClient;


namespace PhotoHsn.Web.Admin.Equipment
{
    public partial class Brands : BasePage
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                EquipmentTypesBs equipmentTypesBs = new EquipmentTypesBs();
                ddlEquipmentTypes.DataTextField = "EquipmentType";
                ddlEquipmentTypes.DataValueField = "Id";
                ddlEquipmentTypes.DataSource = equipmentTypesBs.get_all_with_all_columns();
                ddlEquipmentTypes.DataBind();

                if (ddlEquipmentTypes.Items.Count > 0)
                    ddlEquipmentTypes.SelectedIndex = 0;
                gwBrands_Load();
            }
       
        }

        private void gwBrands_Load()
        {            
            BrandsBs brandsBs = new BrandsBs();
            gwBrands.DataSource = brandsBs.get_all(Convert.ToInt32(ddlEquipmentTypes.SelectedValue));
            gwBrands.DataBind();
        }

        protected void ddlEquipmentTypes_SelectedIndexChanged(object sender, EventArgs e)
        {
            gwBrands_Load();
        }
    }
}